//
//  HLMatchRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/8/17.
//

#import "HLMatchRequest.h"

@implementation HLMatchRequest
{
    NSDictionary *_params;
    HLMatchType _type;
}

- (id)initWithType:(HLMatchType)type params:(NSDictionary *)params
{
    self = [super init];
    
    if (self) {
        _type = type;
        _params = params;
    }
    
    return self;
}



- (NSString *)requestUrl
{
    switch (_type) {
        case HLMatchTypeFateList:
            return @"/user/shanliao/list";
            break;
        case HLMatchTypeFate:
            return @"/user/recommend/rand/female";
            break;
        case HLMatchTypeNight:
            return @"/user/recommend/night/matching";
            break;
        case HLMatchTypeLabelList:
            return  @"/user/label/matching/tag";
            break;
        case HLMatchTypeLabel:
            return @"/user/label/matching/tag/customers";
            break;
        case HLMatchTypeVideo:
            return @"/get/video/match/customer";
            break;
            
        case HLMatchTypeNewVideo:
            return @"/get/video/match/customer";
            break;
    }
    
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodGET;
}

- (id)requestArgument
{
    if (_params){
        return _params;
    } else {
        return @{};
    }
}


-  (HLHomeListModel *)fateUser
{
    HLHomeListModel *user;
    
    NSDictionary *records = [self.result valueForKey:@"data"];
    if ([records isKindOfClass:[NSDictionary class]]) {
       user = [HLHomeListModel mj_objectWithKeyValues:records];
    }
    
    return user;
}

- (NSArray <HLHomeListModel *> *)fateList
{
    NSArray *lists = @[];
    
    NSArray *records = [self.result valueForKey:@"data"];
    if (records.count > 0) {
       lists = [HLHomeListModel mj_objectArrayWithKeyValuesArray:records];
    }
    
    return lists;
}

- (HLMatchNightModel *)night
{
    HLMatchNightModel *night;
    NSDictionary *data = [self.result valueForKey:@"data"];
    if (![data isKindOfClass:[NSDictionary class]]){
        return night;
    }
    if (data.count > 0) {
       night = [HLMatchNightModel mj_objectWithKeyValues:data];
    }
    return night;
}

- (NSArray <HLHomeListModel *> *)discountList
{
    NSArray *lists = @[];
    
    NSDictionary *data = [self.result valueForKey:@"data"];
    if (![data isKindOfClass:[NSDictionary class]]){
        return lists;
    }
    
    NSArray *records = [data valueForKey:@"records"];
    if (records.count > 0) {
       lists = [HLHomeListModel mj_objectArrayWithKeyValuesArray:records];
    }
    
    return lists;
}


- (NSArray <HLMatchLabelModel *> *)labelList
{
    NSArray *lists = @[];
    NSArray *data = [self.result valueForKey:@"data"];
    if (![data isKindOfClass:[NSArray class]]){
        return lists;
    }

    if (data.count > 0) {
       lists = [HLMatchLabelModel mj_objectArrayWithKeyValuesArray:data];
    }
    
    return lists;
}


@end
